package net.mihome.app.bean;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import net.mihome.app.bean.net.ResponsePojo;

public class ShopMenu {
	private Double id;
	private String content;
	private String price;
	private String update_at;
	private String img;
	private Double shop_id;
	private String name;
	private String create_at;
	
	public String getImg() {
		return img;
	}
	public void setImg(String img) {
		this.img = img;
	}
	public Double getId() {
		return id;
	}
	public void setId(Double id) {
		this.id = id;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getPrice() {
		return price;
	}
	public void setPrice(String price) {
		this.price = price;
	}
	public String getUpdate_at() {
		return update_at;
	}
	public void setUpdate_at(String update_at) {
		this.update_at = update_at;
	}
	public Double getShop_id() {
		return shop_id;
	}
	public void setShop_id(Double shop_id) {
		this.shop_id = shop_id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getCreate_at() {
		return create_at;
	}
	public void setCreate_at(String create_at) {
		this.create_at = create_at;
	}
	public static ShopMenu parse(Map map){
		ShopMenu shopMenu=new ShopMenu();
		if(map!=null){
			shopMenu.setId((Double) map.get("id"));
			shopMenu.setCreate_at((String) map.get("create_at"));
			shopMenu.setContent((String) map.get("content"));
			shopMenu.setName((String) map.get("name"));
			shopMenu.setPrice((String) map.get("price"));
			shopMenu.setShop_id((Double) map.get("shop_id"));
			shopMenu.setImg((String) map.get("img"));
			shopMenu.setUpdate_at((String) map.get("update_at"));
		}
		return shopMenu;
	}
	public static List<ShopMenu> parse(ResponsePojo<List<Map>> responsePojo){
		List<ShopMenu> list=new ArrayList<ShopMenu>();
		if(responsePojo!=null){
			List<Map> items=responsePojo.getData();
			if(items!=null&&!items.isEmpty()){
				Iterator<Map> iterator=items.iterator();
				while(iterator.hasNext()){
					Map map=iterator.next();
					ShopMenu shopMenu=ShopMenu.parse(map);
					list.add(shopMenu);
				}
			}
			
		}
		return list;
	}
}
 